<?php

namespace App\Http\Controllers\admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

use DB;

class MakeController extends Controller
{
    public function index(Request $request)
    {	
        $issueid = $request->input('issueid');
    	$list = DB::table('issue')->where('issueid',$issueid)->get();
        // dd($list);
    	return view('admin.issue.make',['list'=>$list]);
    }
    public function store(Request $request)
    {
        $issueid = $request->input('issueid');
        $data = $request->only('return');
        $m = DB::table('issue')->where('issueid',$issueid)->update($data);
        if ($m>0) {
            return redirect('/admin/issue');
           }else{
            return back();
           }
    }
    public function destroy($id)
    {
        $data = array('return'=>'');
        $m = DB::table('issue')->where('issueid',$id)->update($data);
        return redirect('/admin/issue');
    }
    public function edit($id)
    {
        $list = DB::table('issue')->where('issueid',$id)->first();
        return view('admin.issue.edit',['list'=>$list]);
    }
    public function update($id,Request $request)
    {
        $data = $request->only('return');
        $m = DB::table('issue')->where('issueid',$id)->update($data);
        if ($m>0) {
            return redirect('/admin/issue');
           }else{
            return back();
           }
    }
}
